<?php	

function  getBlockedIP(){
	//TODO:Get this list from DB.
	$ban_ip_list = array('68.180.206.184', '64.233.167.99', '127.0.0.1');
	return 	$ban_ip_list;
}

function  getBlockedIPRanges(){
	$ban_ip_range = array('69.*.83.197');
	return 	$ban_ip_range;	
}


function  isRemoteHostBlocked($remoteIP=NULL){
$user_ip=$remoteIP;

$ban_ip_list=getBlockedIP();

	if(in_array($user_ip, $ban_ip_list))
	{
		return true;
	}
$ban_ip_range= getBlockedIPRanges();
	
	/* Check if the Visitor's IP is in our range's list */
	if(!empty($ban_ip_range))
		{
		foreach($ban_ip_range as $range)
		{
			$range = str_replace('*','(.*)', $range);
		
		    if(preg_match('/'.$range.'/', $user_ip))
			{
			  	return true;
			}
		}
	}	
}

?>

